package itdep.domain.education;

import itdep.domain.IisEntity;
import itdep.domain.division.AcademicDepartment;
import itdep.domain.division.Specialization;

import javax.persistence.*;
import java.util.HashSet;
import java.util.Set;

/**
 * @author Ivan Khalopik
 * @version $Revision: 10 $ $Date: 2010-06-16 07:13:04 +0000 (Wed, 16 Jun 2010) $
 */
@Entity
@Table(name = "EDUCATION_PLAN")
public class EducationPlan extends IisEntity {

	@ManyToOne
	@JoinColumn(name = "ID_EDUCATION_SEMESTER", nullable = false)
	private EducationSemester educationSemester;

	@ManyToOne
	@JoinColumn(name = "ID_SUBJECT", nullable = false)
	private Subject subject;

	@ManyToOne
	@JoinColumn(name = "ID_ACADEMIC_DEPARTMENT", nullable = false)
	private AcademicDepartment academicDepartment;

	@ManyToOne
	@JoinColumn(name = "ID_SPECIALIZATION", nullable = true)
	private Specialization specialization;

	@Column(name = "LECTURE_UNIT", nullable = false)
	private int lectureUnit;

	@Column(name = "PRACTICE_UNIT", nullable = false)
	private int practiceUnit;

	@Column(name = "LABORATORY_UNIT", nullable = false)
	private int laboratoryUnit;

	@ManyToMany
	@JoinTable(name = "EDUCATION_PLAN_CONTROL_TYPE",
			joinColumns = @JoinColumn(name = "ID_EDUCATION_PLAN", nullable = false),
			inverseJoinColumns = @JoinColumn(name = "CONTROL_TYPE", nullable = false))
	private Set<ControlType> controlTypes = new HashSet<ControlType>();

	public EducationSemester getEducationSemester() {
		return educationSemester;
	}

	public void setEducationSemester(EducationSemester educationSemester) {
		this.educationSemester = educationSemester;
	}

	public Subject getSubject() {
		return subject;
	}

	public void setSubject(Subject subject) {
		this.subject = subject;
	}

	public AcademicDepartment getAcademicDepartment() {
		return academicDepartment;
	}

	public void setAcademicDepartment(AcademicDepartment academicDepartment) {
		this.academicDepartment = academicDepartment;
	}

	public Specialization getSpecialization() {
		return specialization;
	}

	public void setSpecialization(Specialization specialization) {
		this.specialization = specialization;
	}

	public EducationSemester getSemesterPlan() {
		return educationSemester;
	}

	public void setSemesterPlan(EducationSemester educationSemester) {
		this.educationSemester = educationSemester;
	}

	public int getLectureUnit() {
		return lectureUnit;
	}

	public void setLectureUnit(int lectureUnit) {
		this.lectureUnit = lectureUnit;
	}

	public int getPracticeUnit() {
		return practiceUnit;
	}

	public void setPracticeUnit(int practiceUnit) {
		this.practiceUnit = practiceUnit;
	}

	public int getLaboratoryUnit() {
		return laboratoryUnit;
	}

	public void setLaboratoryUnit(int laboratoryUnit) {
		this.laboratoryUnit = laboratoryUnit;
	}

	public Set<ControlType> getControlTypes() {
		return controlTypes;
	}

	public void setControlTypes(Set<ControlType> controlTypes) {
		this.controlTypes = controlTypes;
	}
}
